﻿Imports System.ComponentModel
Imports System.Collections.ObjectModel
Imports System.IO
Imports System.Xml.Serialization
Imports Licenta3.Common.Framework
Imports Licenta3.Common.Classes
Public Class SetariClass
    Inherits ObjectBase
    Public Shared _lAutorizat As New ObservableCollection(Of TAutorizat)
    Public Property lAutorizat As ObservableCollection(Of TAutorizat)
        Get
            Return _lAutorizat
        End Get
        Set(value As ObservableCollection(Of TAutorizat))
            _lAutorizat = value
            OnPropertyChanged("lAutorizat")
        End Set
    End Property
    Public Shared _currentAutorizat As New TAutorizat
    Public Property currentAutorizat As TAutorizat
        Get
            Return _currentAutorizat
        End Get
        Set(value As TAutorizat)
            ' If _lAutorizat.Contains(value) Then
            _currentAutorizat = value
            OnPropertyChanged("currentAutorizat")
            ' End If
            'ar trebui pus un else ceva cu on error raise, bla bla, etc...
        End Set
    End Property
    Public Shared _LucruPath As String
    Public Property LucruPath As String
        Get
            Return _LucruPath
        End Get
        Set(value As String)
            If Directory.Exists(value) Then
                _LucruPath = value
            Else
                MsgBox("Directorul nu exista!")
            End If
            OnPropertyChanged("LucruPath")
        End Set
    End Property
    Shared _lists As New Dictionar
    Public Property lists As Dictionar
        Get
            Return _lists
        End Get
        Set(value As Dictionar)
            _lists = value
            OnPropertyChanged("Dictionar")
        End Set
    End Property
    'Shared Sub New()
    '    Dim xSetarile As New XmlSerializer(GetType(SetariClass))
    '    Dim setaripath As String = assemblyPath + "\setari.xml"
    '    If File.Exists(setaripath) Then
    '        'Deserialize text file to a new object.
    '        Dim objStreamReader As New StreamReader(setaripath)
    '        Dim setari As Object = xSetarile.Deserialize(objStreamReader)
    '        _lAutorizat = setari.lAutorizat
    '        _currentAutorizat = setari.currentAutorizat
    '        _LucruPath = setari.lucruPath
    '        _lists = setari.lists
    '        'MsgBox(setari.currentAutorizat.Nume)
    '        objStreamReader.Close()

    '    End If
    'End Sub
    Public Sub New()
        '_lAutorizat = __lAutorizat
        '_lAutorizat = deserialize.lAutorizat
        'MsgBox(deserialize.ToString)
    End Sub



End Class